﻿using MediatR;
using S.Initial.Infrastructure.Dto;
using S.Initial.Infrastructure.Interface;
using S.Initial.Read.API.Application.Command.BreedingMothers;

namespace S.Initial.Read.API.Application.CommandHandlers.BreedingMothers
{
    /// <summary>
    /// 查询条件的值
    /// </summary>
    public class ShowChaZhiCommandHandler : IRequestHandler<ShowChaZhiCommand, IEnumerable<InventoryStatisticsDto>>
    {
        private readonly IBreedingMothersRepository breedingMothersRepository;

        public ShowChaZhiCommandHandler(IBreedingMothersRepository breedingMothersRepository)
        {
            this.breedingMothersRepository = breedingMothersRepository;
        }
        /// <summary>
        /// 查询条件的值
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task<IEnumerable<InventoryStatisticsDto>> Handle(ShowChaZhiCommand request, CancellationToken cancellationToken)
        {
            return breedingMothersRepository.ShowChaZhiStatistics(request.Type);
        }
    }
}
